<%@Page Language="VB"%>
<%@ Import Namespace="System.Data" %>
<%@ Import namespace="MyWebServices" %>
<html><head>
<title>
Web Services and 
Web Services</title>
</head>
<body>
<span class="heading">Web Services
and Web Services</span>
<hr width="350" align="left"/>
<div id="outError" runat="server">&nbsp;</div>
 <form id="Form1" method="post" runat="server">
<asp:Label id="lbSQL"  runat="server" >
Select Statement: </asp:Label><br />
<asp:TextBox id="txtSQL" Width="600px"
value="select EmployeeID AS ID,
FirstName + ' ' + LastName AS Name
 from Employees"
runat="server">
</asp:TextBox><br /><br />   
<asp:Button  id="cmdSave" runat="server"  
Text="getDataSet" OnClick="getDataSet">
</asp:Button>	           
</form>
<asp:datagrid id="dgrResult"	 
AutoGenerateColumns="False" runat="server" > 
<Columns> 
<asp:TemplateColumn HeaderText="ID"> 
<ItemTemplate> 
<asp:Label ID="ID" _
Text='<%# DataBinder.Eval(Container.DataItem, _
"ID").toString()%>' 
Runat=server /> 
</ItemTemplate> </asp:TemplateColumn>
 <asp:TemplateColumn HeaderText="Name"> 
<ItemTemplate> 
<asp:Label ID="Name" _
Text='<%# DataBinder.Eval(Container.DataItem, _
"Name").toString()%>' 
Runat=server /> 
</ItemTemplate> </asp:TemplateColumn>
</Columns> </asp:DataGrid> 
<script language="vb" runat="server">
Private Sub getDataSet(ByVal sender As Object, _
ByVal e As EventArgs)  
if txtSQL.Text<>"" then
   Dim myDataSet As New DataSet()
Try    
   Dim strSQL=txtSQL.Text
   Dim ws As New MyWebServices.MyWSDataSetWS()
   myDataSet =ws.getWSDataSet(strSQL)  
 Catch objError As Exception
      	outError.innerHTML = _
	"<b>* Error while " & _
	"accessing data</b>.<br />" _
          	& objError.Message & "<br />" & _
	objError.Source
      Exit Sub  
   End Try   
   dgrResult.DataSource = myDataSet
   dgrResult.DataBind()   
End if
End Sub
</script>
</body>
</html>
  


